import sqlite3


class DB:
    def __init__(self):
        self.conn = sqlite3.connect("user_db.db")

    def get_failure_user_cursor(self):
        c = self.conn.cursor()
        cursor = c.execute("select * from user where grab_lesson is null")
        return cursor

    def update_user_grab_lesson(self, uid, grab_lesson):
        c = self.conn.cursor()
        c.execute("update user set grab_lesson = '{}' where uid = '{}'".format(grab_lesson, uid))

    def close(self):
        self.conn.close()
